import React,{useCallback,useState} from 'react';

const Child = ({text,obj,setObj}) => {
    const [count, setCount] = useState(0)
    const handleClick = useCallback(
        () => {
            console.log('handleClick')
            setObj({prop:'11'})
        },
        [obj.prop],
    )
    return (
        <>
            <div>{text}</div>
            <button onClick={handleClick}>点击</button>
            <div>{obj.prop}</div>
        </>
    )
}
const Father = () => {
    const [obj,setObj] = useState({prop:'222'})
    return (
        <Child text="123" obj={obj} setObj={setObj} />
    )
}
export default Father